#include <algorithm/analytical_model/RectangleGrid.h>
#include <algorithm/analytical_model/algorithm/cpu/VectorConvert.h>
#include <algorithm/analytical_model/algorithm/cuda/inter_op/grid/RectangleGrid.h>
#include <algorithm/analytical_model/algorithm/cuda/inter_op/utils/convert/grid/ConvertGrid.h>
#include <utils/ParaUtils.h>

template <>
void solar::cuda::inter_op::convertGrid(solar::cuda::inter_op::RectangleGrid* input_ptr,
                                        solar::analytical::RectangleGrid* output_ptr)
{
    auto position = cpu::toVec3(input_ptr->getPosition());
    auto size = cpu::toVec3(input_ptr->getSize());
    auto interval = cpu::toVec3(input_ptr->getInterval());
    *output_ptr.*solar::getParaPtr<solar::analytical::RectangleGrid,
                                   __constexpr_char_RectangleGrid_position_>() = position;
    *output_ptr.*solar::getParaPtr<solar::analytical::RectangleGrid,
                                   __constexpr_char_RectangleGrid_size_>() = size;
    *output_ptr.*solar::getParaPtr<solar::analytical::RectangleGrid,
                                   __constexpr_char_RectangleGrid_interval_>() = interval;
}

template <>
void solar::cuda::inter_op::convertGrid(solar::analytical::RectangleGrid* input_ptr,
                                        solar::cuda::inter_op::RectangleGrid* output_ptr)
{
    auto position =
        cpu::toFloat3(*input_ptr.*solar::getParaPtr<solar::analytical::RectangleGrid,
                                                    __constexpr_char_RectangleGrid_position_>());
    auto size =
        cpu::toFloat3(*input_ptr.*solar::getParaPtr<solar::analytical::RectangleGrid,
                                                    __constexpr_char_RectangleGrid_size_>());
    auto interval =
        cpu::toFloat3(*input_ptr.*solar::getParaPtr<solar::analytical::RectangleGrid,
                                                    __constexpr_char_RectangleGrid_interval_>());
    output_ptr->setPosition(position);
    output_ptr->setSize(size);
    output_ptr->setInterval(interval);
}
